require_relative 'report'
require_relative 'report_base'

class HtmlReport

  def initialize report_base
    @report = Report.new report_base, self
  end

   def output_start
     puts "<html>"
   end
   def output_head
     puts "<head><title>Report</title></head>"
   end
   def output_body_start
     puts "<body>"
   end
   def output_body
     puts "<h1>Players which participated in a game:</h1>"
     @report.report_base.players.each do |player|
       puts "<b> #{player.name} </b></br>"
     end
     puts "<h2>Number of rounds played: #{@report.report_base.no_of_rounds}</h2>"
     puts "<h2>Results: </h2>"
     @report.report_base.results.each do |name, resultss|
       puts "<b> #{name} </b> won #{@report.report_base.results[name].length} times with these cards: #{resultss} </br>"
     end
     puts "<b>Number of cards in Deck: </b>#{@report.report_base.deck.no_of_cards}"
     puts "<b>Card values in Deck: </b>#{@report.report_base.deck.to_s}"
   end
   def output_body_end
     puts "</body>"
   end
   def output_end
     puts "</html>"
   end
   def generate_report
     @report.generate_report
   end
end